package dawnland03.model.quest;

import java.util.HashMap;
import java.util.Map;

/**
 * User: Petru Obreja (obrejap@yahoo.com)
 * Date: Jan 23, 2010
 * Time: 6:17:11 PM
 */
public class Quest {
    private final Integer id;
    private final QuestType questType;
    private final Map<QuestParam, Object> params;

    Quest(Integer id, QuestType questType) {
        this.id = id;
        this.questType = questType;
        this.params = new HashMap<QuestParam, Object>();
    }

    Quest(Integer id, QuestType questType, Map<QuestParam, Object> params) {
        this.id = id;
        this.questType = questType;
        this.params = params;
    }

    public Object getParam(QuestParam questParam) {
        return params.get(questParam);
    }

    public QuestType getQuestType() {
        return questType;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Quest quest = (Quest) o;

        if (!id.equals(quest.id)) return false;

        return true;
    }

    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String toString() {
        return "Q:("+id+"-"+questType+")";
    }
}
